package com.zsx.shopping.auth.controller;

import com.zsx.shopping.auth.service.VerifyService;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/auth")
public class VerifyController {

    @Resource
    private VerifyService verifyService;

    @GetMapping(value = "/codeImage", produces = MediaType.IMAGE_PNG_VALUE)
    public void codeImage(@RequestParam Integer width,
                          @RequestParam Integer height,
                          HttpServletResponse response) {
        verifyService.setVerifyCode(width, height, response);
    }
}
